home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Utilities / InstallerMaker™ / InstallerMaker__2.0.2_Installe / InstallerMaker™ 2.0.2 Installer / InstallerMaker Extensions / ICnd Extension / HasFPUICnd.p < prev    next >
Text File  |  1994-05-03  |  4KB  |  114 lines

  1. (* ****************************************************************
  2.  
  3.         HasFPUICnd.p
  4.                     Written in MPW Pascal by Darryl Lovato (dgl)
  5.                     and Jim Merritt (jam).
  6.                     
  7.         Copyright © 1993 Aladdin Systems, Inc.
  8.         All Rights Reserved.
  9.         
  10.         In combination with the associated make file
  11.         (HasFPUICnd.make), this source text produces an ICnd
  12.         installer extension, which can be called by a Product
  13.         Installer during the installation process.  Specifications
  14.         for IBeg, IMid, ICnd, and IEnd extensions are given in the
  15.         documentation for StuffIt InstallerMaker™.
  16.         
  17.         This subroutine performs the following function:
  18.            
  19.         • Returns 0 (i.e., install the associated item) if (Custom
  20.           Condition Bits 0 and 1 are both off or both on).
  21.         • Returns 1 (i.e., do NOT install the associated item) if
  22.           (Custom Condition Bit 0 is on) AND (FPU is NOT present)
  23.           or if (Custom Condition Bit 1 is on) AND (FPU is present).
  24.           
  25.         Note that the Gestalt feature of InstallerMaker 2.0 makes
  26.         it possible to check this condition without using an
  27.         InstallerMaker extension.  However, if you must check
  28.         several conditions at once, you may want to use a combination
  29.         of the built-in Gestalt feature and an ICnd routine that
  30.         checks other Gestalt conditions.  In such situations, you
  31.         may use this routine as your model.
  32.         
  33.         CHANGE HISTORY:
  34.         
  35.         VER    DATE        ENGR    DESCRIPTION
  36.         1    93.06.21    dgl        Prototype version.
  37.         2    93.06.23    jam        Added commentary, modified style to
  38.                                 match other source files in the
  39.                                 InstallerMaker suite, increased
  40.                                 portability across various Pascal
  41.                                 compilers, and rearranged logic to
  42.                                 provide for "care/don't care"
  43.                                 interpretation of custom condition
  44.                                 bit 0 setting in the installermaker
  45.                                 archive window.
  46.         3    93.11.10    jam        Fixed sense of Gestalt result check.
  47.         4    94.03.14    jam        Modified CustomConditionCheck to observe
  48.                                 new packages parameter.
  49.         5    94.03.23    jam        Modified CustomConditionCheck to use
  50.                                 two flags, one for "install this only if
  51.                                 FPU Present," and the other for "install
  52.                                 this only if FPU NOT present."
  53.                                 Also added NeedsFPU and NeedsNoFPU
  54.                                 constants.
  55. ****************************************************************** *)
  56.  
  57. (*$Z+*) (*    Allows linker to find CustomConditionCheck without declaring it
  58.             in the interface *)    
  59. UNIT ICnd;
  60.  
  61. INTERFACE
  62.  
  63. IMPLEMENTATION
  64.  
  65.    USES
  66.      Types,
  67.      GestaltEqu;
  68.  
  69.   FUNCTION CustomConditionCheck(theFlags : INTEGER;
  70.                                   packages: INTEGER): INTEGER;
  71.   (* Bit 0, 1, and 2 in theFlags are passed from the installer.
  72.      Return 0 to install the item, and 1 to NOT install the item.
  73.   *)
  74.     CONST
  75.       CCBit0= $0001;
  76.       CCBit1= $0002;
  77.       CCBit2= $0004;
  78.       
  79.       OKToContinue= 0; (* Return value to install the current item. *)
  80.       SkipThisItem= 1; (* Return value to skip the current item. *)
  81.       
  82.       (* In the InstallerMaker archive window, setting custom-condition
  83.          flag bit 0 implies that we care about an FPU, and that the
  84.          associated item will only be installed if an FPU is present.
  85.          Setting custom-condition flag bit 1 implies that we care about
  86.          an FPU, and that the associated item will only be installed if
  87.          an FPU is NOT present.  Setting both bits is a contradiction,
  88.          but we will interpret it as meaning that the associated item will
  89.          be installed for all cases.
  90.       *)
  91.       NeedsFPU= CCBit0;
  92.       NeedsNoFPU= CCBit1;
  93.       
  94.     VAR
  95.       err: INTEGER;
  96.       result: LongInt;
  97.     BEGIN (* CustomConditionCheck *)
  98.       (* Install the item unless we determine otherwise. *) 
  99.       CustomConditionCheck := OKToContinue;
  100.       IF ((BAND(NeedsFPU+NeedsNoFPU,theFlags) <> 0)
  101.          AND (BAND(NeedsFPU+NeedsNoFPU,theFlags) <> (NeedsFPU+NeedsNoFPU))) THEN      
  102.         BEGIN (* One of the two flag bits was set, so we care about FPU *)
  103.           IF (Gestalt(gestaltFPUType, result) = noErr) THEN
  104.           (* Gestalt worked, so we can check for FPU *)
  105.             BEGIN
  106.               IF (result = gestaltNoFPU) THEN
  107.                   CustomConditionCheck := SkipThisItem;
  108.             END
  109.           ELSE (* Assume no Gestalt = No FPU *)
  110.               CustomConditionCheck := SkipThisItem;
  111.         END (* IF We care about FPU *);
  112.     END (* CustomConditionCheck *);
  113.     
  114. END (* ICnd *).